package com.concurrent.mapper;

import com.concurrent.domain.SpringScheduledCron;
import com.concurrent.domain.SpringScheduledCronExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SpringScheduledCronMapper {
    @SelectProvider(type=SpringScheduledCronSqlProvider.class, method="countByExample")
    int countByExample(SpringScheduledCronExample example);

    @DeleteProvider(type=SpringScheduledCronSqlProvider.class, method="deleteByExample")
    int deleteByExample(SpringScheduledCronExample example);

    @Delete({
        "delete from spring_scheduled_cron",
        "where cron_id = #{cronId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer cronId);

    @Insert({
        "insert into spring_scheduled_cron (cron_key, cron_expression, ",
        "task_explain, status)",
        "values (#{cronKey,jdbcType=VARCHAR}, #{cronExpression,jdbcType=VARCHAR}, ",
        "#{taskExplain,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="cronId")
    int insert(SpringScheduledCron record);

    @InsertProvider(type=SpringScheduledCronSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="cronId")
    int insertSelective(SpringScheduledCron record);

    @SelectProvider(type=SpringScheduledCronSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="cron_id", property="cronId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="cron_key", property="cronKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="cron_expression", property="cronExpression", jdbcType=JdbcType.VARCHAR),
        @Result(column="task_explain", property="taskExplain", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT)
    })
    List<SpringScheduledCron> selectByExample(SpringScheduledCronExample example);

    @Select({
        "select",
        "cron_id, cron_key, cron_expression, task_explain, status",
        "from spring_scheduled_cron",
        "where cron_id = #{cronId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="cron_id", property="cronId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="cron_key", property="cronKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="cron_expression", property="cronExpression", jdbcType=JdbcType.VARCHAR),
        @Result(column="task_explain", property="taskExplain", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.TINYINT)
    })
    SpringScheduledCron selectByPrimaryKey(Integer cronId);

    @UpdateProvider(type=SpringScheduledCronSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SpringScheduledCron record, @Param("example") SpringScheduledCronExample example);

    @UpdateProvider(type=SpringScheduledCronSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SpringScheduledCron record, @Param("example") SpringScheduledCronExample example);

    @UpdateProvider(type=SpringScheduledCronSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SpringScheduledCron record);

    @Update({
        "update spring_scheduled_cron",
        "set cron_key = #{cronKey,jdbcType=VARCHAR},",
          "cron_expression = #{cronExpression,jdbcType=VARCHAR},",
          "task_explain = #{taskExplain,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=TINYINT}",
        "where cron_id = #{cronId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SpringScheduledCron record);

    @Select({
            "select",
            "cron_id, cron_key, cron_expression, task_explain, status",
            "from spring_scheduled_cron"
    })
    @Results({
            @Result(column="cron_id", property="cronId", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="cron_key", property="cronKey", jdbcType=JdbcType.VARCHAR),
            @Result(column="cron_expression", property="cronExpression", jdbcType=JdbcType.VARCHAR),
            @Result(column="task_explain", property="taskExplain", jdbcType=JdbcType.VARCHAR),
            @Result(column="status", property="status", jdbcType=JdbcType.TINYINT)
    })
    List<SpringScheduledCron> selectAll();

    @Select({
            "select",
            "cron_id, cron_key, cron_expression, task_explain, status",
            "from spring_scheduled_cron",
            "where cron_key = #{cronKey,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="cron_id", property="cronId", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="cron_key", property="cronKey", jdbcType=JdbcType.VARCHAR),
            @Result(column="cron_expression", property="cronExpression", jdbcType=JdbcType.VARCHAR),
            @Result(column="task_explain", property="taskExplain", jdbcType=JdbcType.VARCHAR),
            @Result(column="status", property="status", jdbcType=JdbcType.TINYINT)
    })
    SpringScheduledCron selectByCron_key(String cronKey);
}